ci: add lychee dead-link detection workflows#346
Conversation
Adds two workflows plus a shared lychee config: - link-check-pr.yml runs on PRs that touch .md/.mdx files, scoped to the changed files only and limited to external http(s) URLs. Internal links are already validated by Docusaurus in build.yml. Non-blocking via continue-on-error during a tuning period. - link-check-weekly.yml runs Mondays 12:00 UTC and on workflow_dispatch. Builds the site and crawls rendered HTML under build/docs, community, and faq. On failure, opens or updates a single rolling GitHub issue labeled link-rot. - lychee.toml: shared cache, retries, and excludes for both jobs. Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
Temporary. This commit will be reverted in the next commit on this branch. Verifies that link-check-pr.yml correctly fails when a PR introduces an unreachable external URL. Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
lycheeverse/lychee-action@v2 exposes exit_code as a step output, not an env var. The previous env.lychee_exit_code reference was always empty, and '' != '0' evaluates to true, which would have caused the tracking issue to be opened/updated on every weekly run regardless of whether any links were actually broken. Signed-off-by: “Kevin” <kevlar_ksb@yahoo.com>
Code Review ✅ Approved 2 resolved / 2 findingsImplements automated external dead-link detection with PR checks and a weekly crawler, addressing the initial broken link canary and exit code variable reference. No issues found. ✅ 2 resolved✅ Bug: Canary broken link must not be merged
✅ Bug: Weekly workflow uses wrong env var for lychee exit code
Rules ✅ All requirements metRepository Rules
1 rule not applicable. Show all rules by commenting OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
What changed?
Adds three new files for external-link checking via
lycheeverse/lychee-action:lychee.toml— shared config (1d cache, 3 retries, accepts 429, excludes localhost/LinkedIn)..github/workflows/link-check-pr.yml— runs on PRs touching*.md/*.mdx. Scoped to changed files only and limited to externalhttp(s)URLs via--scheme. Non-blocking viacontinue-on-error: truefor a tuning period..github/workflows/link-check-weekly.yml— Monday 12:00 UTC +workflow_dispatch. Builds the site, crawls HTML underbuild/{docs,community,faq}, and opens/updates a single rolling issue labeledlink-roton failure.Why?
Catch external 404s before merge and track link rot over time. Internal links are already validated by Docusaurus's
onBrokenLinks: 'throw'inbuild.yml, so the PR check is intentionally external-only — re-checking internal links in lychee would be redundant and prone to false positives because lychee can't replay Docusaurus's slug routing.How did you verify it?
End-to-end in my fork before opening this PR:
[lychee-canary-do-not-merge](https://httpbin.org/status/404)to a docs page.Link check (PR) / lycheewent red naming the canary URL, whileBuildstayed green and merge was not blocked.Link check (PR) / lycheewent green.The weekly workflow only runs from
master. Plan is to trigger it once via Actions →workflow_dispatchafter merge to validate the build → crawl → issue-create flow.Potential risks
lycheeverse/lychee-action@v2,tj-actions/changed-files@v45,peter-evans/create-issue-from-file@v5. All widely used and actively maintained.lychee.toml(exclude/accept) as flakes appear.continue-on-error: trueand markLink check (PR) / lycheeas a required status check in branch protection.Related changes
None.